package com.zhongfl.crm.service.impl.boss;

import com.zhongfl.crm.lixiao.mapper.ChannelRevisitLogMapper;
import com.zhongfl.crm.service.boss.ChannelRevisitLogService;
import com.zhongfl.crm.model.boss.ChannelRevisitLog;
import org.springframework.stereotype.Service;
import tech.heptagram.channel.api.common.AssertUtils;

import javax.annotation.Resource;

/**
 * ChannelRevisitLogServiceImpl 服务类
 *
 * @author tiantian
 * @date 2018/7/12 12:12
 */
@Service
public class ChannelRevisitLogServiceImpl implements ChannelRevisitLogService {

    @Resource
    private ChannelRevisitLogMapper channelRevisitLogMapper;

    @Override
    public void save(ChannelRevisitLog revisitLog) {
        AssertUtils.notNull(revisitLog, "记录为空！");

        channelRevisitLogMapper.insertSelective(revisitLog);
    }

    @Override
    public void updateById(ChannelRevisitLog revisitLog) {
        AssertUtils.notNull(revisitLog, "记录为空！");
        AssertUtils.notNull(revisitLog.getId(), "记录id为空！");
        channelRevisitLogMapper.updateByIdSelective(revisitLog);
    }

    @Override
    public void deleteById(Integer id, String name) {
        AssertUtils.notNull(id, "id为空！");
        AssertUtils.hasText(name, "操作人为空！");
        channelRevisitLogMapper.deleteById(id,name);
    }

    @Override
    public ChannelRevisitLog findById(Integer id) {
        AssertUtils.notNull(id, "id为空！");
        return channelRevisitLogMapper.selectById(id);
    }

    @Override
    public ChannelRevisitLog findByLxRevisitLogId(Long id) {
        AssertUtils.notNull(id, "励销跟进记录id为空！");
        return channelRevisitLogMapper.selectByLxRevisitLogId(id);
    }
}
